﻿@model SIFIET.Models.User
@{
    ViewBag.Title = "Crear";
}
<script type="text/javascript">
    $(document).ready(function () {
        $("#txtBirtDate").datepicker({ dateFormat: 'dd/mm/yy' });
    });
</script>

<script type="text/javascript">
//    $(document).ready(function () {
//        $("#txtBirtDate").change(function () {
//            var now = new Date();
//            var errorDate = false;
//            var startDt = $("#txtBirtDate").val();
//            var endDt = now.getDate() + "-" + now.getMonth() + "-" + now.getFullYear();
//            var aI = startDt.substring(0, 4);
//            var aF = endDt.substring(5, 10);
//            if (aI == aF) {
//                var mI = startDt.substring(5, 7);
//                var mF = endDt.substring(3, 4);
//                if (mI <= mF) {
//                    var dI = startDt.substring(8, 10);
//                    var dF = endDt.substring(0, 2);
//                    if (dI > dF) {
//                        errorDate = true;
//                    }
//                } else {
//                    errorDate = true;
//                }
//            } else {
//                if (aI > aF) {
//                    errorDate = true;
//                }
//            }
//            if (errorDate) {
//                $('<p>').text('Su fecha  de cumpleaños no debe ser posterior a la fecha actual').appendTo('#ErrorBirthDate').hide(20000, function () { $(this).remove(); });
//                $("#txtBirtDate").val("");
//            }
//        });
//    });
</script>

<h2>Información Personal</h2>

<script src="@Url.Content("~/Scripts/jquery.validate.min.js")" type="text/javascript"></script>
<script src="@Url.Content("~/Scripts/jquery.validate.unobtrusive.min.js")" type="text/javascript"></script>

@using (Html.BeginForm())
{
    @Html.ValidationSummary(true)
    <fieldset>
        <legend>Usuario </legend>
        <div class="alert success"> @TempData["Error"]</div>
        <p>Los campos marcados con (*) son obligatorios</p>

        <div class="editor-label">
           <h3> @Html.LabelFor(model => model.PhoneNumber)</h3>
        </div>
        <div class="editor-field">
            @Html.EditorFor(model => model.PhoneNumber)
            @Html.ValidationMessageFor(model => model.PhoneNumber)
        </div>
        <div class="editor-label">
            <h3> @Html.LabelFor(model => model.FirstNames)</h3>
        </div>
        <div class="editor-field">
            @Html.EditorFor(model => model.FirstNames)
            @Html.ValidationMessageFor(model => model.FirstNames)
        </div>
        <div class="editor-label">
            <h3>@Html.LabelFor(model => model.LastNames)</h3>
        </div>
        <div class="editor-field">
            @Html.EditorFor(model => model.LastNames)
            @Html.ValidationMessageFor(model => model.LastNames)
        </div>
        <div class="editor-label">
           <h3> @Html.LabelFor(model => model.Address)</h3>
        </div>
        <div class="editor-field">
            @Html.EditorFor(model => model.Address)
            @Html.ValidationMessageFor(model => model.Address)
        </div>
        <div class="editor-label">
           <h3> @Html.LabelFor(model => model.CellphoneNumber)</h3>
        </div>
        <div class="editor-field">
            @Html.EditorFor(model => model.CellphoneNumber)
            @Html.ValidationMessageFor(model => model.CellphoneNumber)
        </div>
        <div class="editor-label">
           @*<h3> @Html.LabelFor(model => model.BirthDate)</h3>*@
        </div>
        <div class="editor-field">
            @*@Html.EditorFor(model => model.BirthDate)*@
            @*@Html.TextBox("txtBirtDate", "", new { @type = "date", @placeholder = "DD/MM/AAAA" })*@
        </div>
        <div class="alert error" id = "ErrorBirthDate"></div>
        <div class="editor-label">
           <h3> @Html.LabelFor(model => model.Gender)</h3>
            <div>
                @Html.RadioButtonFor(model => model.Gender, "M")
                Masculino
            </div>
            <div>
                @Html.RadioButtonFor(model => model.Gender, "F")
                Femenino
            </div>
        </div>
        <div class="editor-label">
            <h3>@Html.LabelFor(model => model.MaritalStatus)</h3>
        </div>
        <div class="editor-field">
            <div>
                @Html.RadioButtonFor(model => model.MaritalStatus, "Soltero")
                Soltero
            </div>
            <div>
                @Html.RadioButtonFor(model => model.MaritalStatus, "Casado")
                Casado
            </div>
            <div>
                @Html.RadioButtonFor(model => model.MaritalStatus, "U Libre")
                Unión Libre
            </div>           
            <div>
                &nbsp
            </div>
        </div>
        <div>
            <input type="submit" value="Registrar" class="ebutton blue" />
            &nbsp
            @Html.ActionLink("Cancelar", "Index", "Home", "", htmlAttributes: new { @class = "ebutton blue" })
        </div>
    </fieldset>
}


